import random
print ('猜数字游戏')
number = random.randint(1,100)
count = 0
i = 5000
while True:
     guess = int(input('输入数字:'))
     count += 1
     if guess > number:
        print('猜大了')
        i = i - 500
        print('剩余金币')
        print(i)
     else :
        print('猜小了')
        i = i-500
        print('剩余金币')
        print(i)
        if guess == number:
            print('恭喜猜中，本轮幸运数字')
            print(number)
            i = i + 3000
            print('剩余金币')
            choice = input('是否继续游戏？(Y/N):')
            if choice.upper() != 'Y':
                break
            else:
                i = i
     if i <= 0:
            print ('没钱了充钱去')







